package com.rill.fckeditor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import net.fckeditor.requestcycle.UserPathBuilder;

/**动态实现fck上传服务器的多用户目录保存：1.实现UserPathBuilder  2.fckeditor.properties中指定其实现类MyUserPath
 */
public class MyUserPath implements UserPathBuilder {

	@Override
	public String getUserFilesPath(HttpServletRequest request) {
		//获取请求的会话，获取username
		HttpSession session = request.getSession();
		String username = (String)session.getAttribute("username");//会话中动态获取username
		return "/userFiles/" + username;//返回设置的用户路径,以用户名命名
	}

}
